package com.ywgt;

import java.util.Arrays;

/**
 * 选择排序，每次拿出剩余的最小的值往最前面放
 */
public class SelectSort {
    public static void main(String[] args) {
        int [] arr={125,265,2466,3215,0,124};
        int temp=0;
        for (int i = 0; i < arr.length-1; i++) {
            for (int j = i+1; j <arr.length ; j++) {
                if(arr[j]<arr[i]){
                    temp=arr[i];
                    arr[i]=arr[j];
                    arr[j]=temp;
                }
            }
            System.out.println(Arrays.toString(arr));
        }
    }
}
